<!-- 当前模块：个人信息 -->
<template>
  <div class="page_ownerInfo">
    <div class="page_ownerInfo-title">小区信息</div>
    <van-cell title="小区编码" :value="form.communityId"></van-cell>
    <van-cell title="小区名称" :value="form.communityName"></van-cell>
    <div class="bottom12"></div>
    <div class="page_ownerInfo-title">业主信息</div>
    <van-cell title="姓名" :value="form.appUserName"></van-cell>
    <van-cell title="身份证" :value="form.idCard"></van-cell>
    <van-cell title="手机号" :value="form.link"></van-cell>
  </div>
</template>

<script>
import {api} from '@/utils/api';
export default {
  data () {
    return {
      form: {}
    }
  },
  onShow() {
    this.getListFn();
  },
  onPullDownRefresh() {
    wx.startPullDownRefresh({
      success: res=>{
        this.getListFn();
      },
      complete: () => {
        wx.stopPullDownRefresh();
      }
    })
  },
  onShareAppMessage() {
    return {
      title: '智慧养老',
      path: '/pages/auth/main',
      from: "menu" 
    }
  },
  methods: {
    async getListFn() { /** 获取小区信息 */
      let data = {
        openId: this.$store.getters.userInfo.openId
      }
      wx.showLoading({ title: '加载中', mask: true });
      const res = await api.listAppUserBindingOwners(data);
      if(res.code == 0) {
        (Array.isArray(res.data) && res.data.length) && (this.form = res.data[0]);
      } else {
        wx.showToast({
          title: res.msg || '请求异常',
          icon: "none"
        })
      }
      setTimeout(() => { wx.hideLoading(); }, 500);
    },
    handleRouter(obj) { /**路由跳转 */
      wx.navigateTo({
        url: "/pages/myHouseDetail/main?info="+JSON.stringify(obj)
      })
    }
  }
}
</script>

<style>
.page_ownerInfo {
  height: 100vh;
  background: #f5f5f5;
  padding: 24rpx;
}
.page_ownerInfo-title {
  font-size: 32rpx;
  color: #999;
  margin-bottom: 12rpx;
}
.title-class {
  flex: none;
  flex-shrink: 0;
  font-size: 32rpx;
}
.value-class {
  font-size: 28rpx;
}
</style>
